00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef PSPMODULEINFO_H
00015 #define PSPMODULEINFO_H
00016
00017
00018
00019
00020
00021
00022 typedef struct _scemoduleinfo {
00023 unsigned short modattribute;
00024 unsigned char modversion[2];
00025 char modname[27];
00026 char terminal;
00027 void * gp_value;
00028 void * ent_top;
00029 void * ent_end;
00030 void * stub_top;
00031 void * stub_end;
00032 } _sceModuleInfo;
00033
00034 typedef const _sceModuleInfo SceModuleInfo;
00035
00036 extern char _gp[];
00037
00038 enum PspModuleInfoAttr
00039 {
00040 PSP_MODULE_USER = 0,
00041 PSP_MODULE_KERNEL = 0x1000,
00042 };
00043
00044 #ifdef __cplusplus
00045
00046
00047 #define PSP_MODULE_INFO(name, attributes, major_version, minor_version) \
00048 __asm__ ( \
00049 " .set push\n" \
00050 " .section .lib.ent.top, \"a\", @progbits\n" \
00051 " .align 2\n" \
00052 " .word 0\n" \
00053 "__lib_ent_top:\n" \
00054 " .section .lib.ent.btm, \"a\", @progbits\n" \
00055 " .align 2\n" \
00056 "__lib_ent_bottom:\n" \
00057 " .word 0\n" \
00058 " .section .lib.stub.top, \"a\", @progbits\n" \
00059 " .align 2\n" \
00060 " .word 0\n" \
00061 "__lib_stub_top:\n" \
00062 " .section .lib.stub.btm, \"a\", @progbits\n" \
00063 " .align 2\n" \
00064 "__lib_stub_bottom:\n" \
00065 " .word 0\n" \
00066 " .set pop\n" \
00067 ); \
00068 extern char __lib_ent_top[], __lib_ent_bottom[]; \
00069 extern char __lib_stub_top[], __lib_stub_bottom[]; \
00070 extern SceModuleInfo module_info \
00071 __attribute__((section(".rodata.sceModuleInfo"), \
00072 aligned(16), unused)) = { \
00073 attributes, { minor_version, major_version }, #name, 0, _gp, \
00074 __lib_ent_top, __lib_ent_bottom, \
00075 __lib_stub_top, __lib_stub_bottom \
00076 }
00077 #else
00078
00079 #define PSP_MODULE_INFO(name, attributes, major_version, minor_version) \
00080 __asm__ ( \
00081 " .set push\n" \
00082 " .section .lib.ent.top, \"a\", @progbits\n" \
00083 " .align 2\n" \
00084 " .word 0\n" \
00085 "__lib_ent_top:\n" \
00086 " .section .lib.ent.btm, \"a\", @progbits\n" \
00087 " .align 2\n" \
00088 "__lib_ent_bottom:\n" \
00089 " .word 0\n" \
00090 " .section .lib.stub.top, \"a\", @progbits\n" \
00091 " .align 2\n" \
00092 " .word 0\n" \
00093 "__lib_stub_top:\n" \
00094 " .section .lib.stub.btm, \"a\", @progbits\n" \
00095 " .align 2\n" \
00096 "__lib_stub_bottom:\n" \
00097 " .word 0\n" \
00098 " .set pop\n" \
00099 ); \
00100 extern char __lib_ent_top[], __lib_ent_bottom[]; \
00101 extern char __lib_stub_top[], __lib_stub_bottom[]; \
00102 SceModuleInfo module_info \
00103 __attribute__((section(".rodata.sceModuleInfo"), \
00104 aligned(16), unused)) = { \
00105 attributes, { minor_version, major_version }, name, 0, _gp, \
00106 __lib_ent_top, __lib_ent_bottom, \
00107 __lib_stub_top, __lib_stub_bottom \
00108 }
00109 #endif
00110
00111
00112 #define PSP_MAIN_THREAD_PRIORITY(priority) \
00113 unsigned int sce_newlib_priority = (priority)
00114
00115 #define PSP_MAIN_THREAD_STACK_SIZE_KB(size_kb) \
00116 unsigned int sce_newlib_stack_kb_size = (size_kb)
00117
00118 #define PSP_MAIN_THREAD_ATTR(attr) \
00119 unsigned int sce_newlib_attribute = (attr)
00120 #define PSP_MAIN_THREAD_ATTRIBUTE PSP_MAIN_THREAD_ATTR
00121
00122
00123 #define PSP_MAIN_THREAD_PARAMS(priority, size_kb, attribute) \
00124 PSP_MAIN_THREAD_PRIORITY(priority); \
00125 PSP_MAIN_THREAD_STACK_SIZE_KB(size_kb); \
00126 PSP_MAIN_THREAD_ATTR(attribute)
00127
00128
00129 #define PSP_NO_CREATE_MAIN_THREAD() \
00130 int sce_newlib_nocreate_thread_in_start = 1
00131
00132
00133 #define PSP_HEAP_SIZE_KB(size_kb) \
00134 unsigned int sce_newlib_heap_kb_size = (size_kb)
00135
00136
00137 #define PSP_MAIN_THREAD_NAME(s) const char* sce_newlib_main_thread_name = (s)
00138
00139 #endif